home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 11
/
CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso
/
cucd
/
programming
/
dignet
/
docs
/
dignet.doc
next >
Wrap
Text File
|
1997-03-29
|
38KB
|
1,483 lines
TABLE OF CONTENTS
dignet.library/---resourcetracking---
dignet.library/AbortNet
dignet.library/AllocNet
dignet.library/CallModemDP
dignet.library/CallModemDT
dignet.library/ConvertModemString
dignet.library/FlushNet
dignet.library/FreeNet
dignet.library/GetBaudrate
dignet.library/GetCurrentDevice
dignet.library/GetCurrentUnit
dignet.library/GetIOmsg
dignet.library/GetModemStatus
dignet.library/GetNetport
dignet.library/HangupModem
dignet.library/InitIOEXT
dignet.library/InitModem
dignet.library/ObtainNet
dignet.library/ParseConnect
dignet.library/QueryNet
dignet.library/ReadIOEXT
dignet.library/ReadNet
dignet.library/ReadString
dignet.library/RTAbort
dignet.library/RTCheck
dignet.library/RTFlush
dignet.library/RTHighestID
dignet.library/RTKillNet
dignet.library/RTNetInfo
dignet.library/RTNumberofNets
dignet.library/SetBaud
dignet.library/SetDefault
dignet.library/StopWaiting
dignet.library/Timeout
dignet.library/WriteNet
dignet.library/WriteString
dignet.library/---resourcetracking--- dignet.library/---resourcetracking---
In dignet.library version 3+ you will find special functions for resource
tracking. All functions that has something to do with resource tracking
begine with the lettes RT. They are not within the safty net as the other
functions are so you should be very careful when using those.
You can now create your own RT tools for the dignet.library
NOTE:
You should not use these functions as an replacement for the ordinary
functions. The arguments is NOT compatible. They should only be used for
debug reasons. If you don't know what you're doing you are more or less
guaranteed a system crash. You have been warned.
PROCEDURE:
You should always use the RTCheck() function first. If this function return
FALSE there is a mismatch in the resource list and alloclist. The system is
unstable.
If RTCheck() return TRUE you should check how many nets are available with
the RTNumberOfNets(). If null exit. Alternativly and recommended you could
use the RTHighestID() to find the highest net ID used.
Then you should use the RTNetInfo() and check parse the list until you get
to the highest ID (maximum 1024). If the DNRT_TASKSTATUS is FALSE you have
resources that you can free.
You can then use RTKillNet() on the current ID number or dump information
to a console or file.
You can use RTAbortNet(), RTFlushNet and RTNetInfo() on a healthy task.
dignet.library/AbortNet dignet.library/AbortNet
NAME
AbortNet -- aborts the device's IO
SYNOPSIS
error=AbortNet(net)
a0
ULONG AbortNet(APTR);
FUNCTION
This function will abort the iorequests at the device. All iorequests are
stopped immediatly. Read the serial.doc for more information on how this
works.
From version 3 this function doesn't flush the net any longer. Use the
FlushNet() function for that.
INPUTS
net - ptr. to a valid net structure
RESULTS
error - return null or an errorcode
NOTES
From version 3 this function no longer flushes the net.
EXAMPLE
BUGS
SEE ALSO
FlushNet(), serial.doc
dignet.library/AllocNet dignet.library/AllocNet
NAME
AllocNet -- Allocates a private structure to use with the other functions
SYNOPSIS
net=AllocNet(devicename,unit)
a1 d0
APTR AllocNet(STRPTR,UWORD);
FUNCTION
To use any of the functions in this library you need to allocate a net
structure. This structure is private. The structure information is needed
for the other functions to know where and what to read/write. It also
allocates memory to use with IOEXT, message structures and so on.
Additionally the device get flushed and aborted at startup to make a clean
start for user. When this function returns true you are ready to use the
device (Note: opposite of a OpenDevice() call).
CHANGES: From version 3 of this library this function no longer inits the
device with a default setting (see SetDefault()). That means it use the
setup you have defined in the serial preference program on your system.
However if you find it difficult to configure it correctly you could use
the SetDefault() function to set the device to a "safe" setup which
supports highspeed and 8-bits transfers.
INPUTS
devicename - ptr. to the device name you want to open [0]
unit - unit number
RESULTS
net - ptr. to a private structure or NULL if any errors.
NOTES
NOTE: Devices returns NULL when succeeded. This library function will not
reflect this result. It will return NULL only if a failure occured such
as out of memory or the port couldn't be created or the device couldn't
be opened. There is currently no way within the library to find the exact
cause of the problem.
However, most other functions in this library returns NULL when things
went well since they reflect the io_error field. Keep this in mind!
NOTE WELL: Max length of taskname and device name is 127 (including the
null byte termination).
Max open nets is currently 1024 (normally you use 1).
EXAMPLE
From C -
Net=AllocNet("serial.device",0)
From Assembler -
move.l DignetBase,a6 ;library base in a6
lea DeviceName,a0 ;device name in a0
moveq #0,d0 ;unit number in d0
jsr _LVOAllocNet(a6) ;call function
move.l d0,Net ;store pointer
beq Error ;if null go to error handling
BUGS
An exact cause of an error should be implemented.
SEE ALSO
FreeNet(), SetDefault()
dignet.library/CallModemDP dignet.library/CallModemDP
dignet.library/CallModemDT dignet.library/CallModemDT
NAME
CallModem -- Do the dialup and check procedure for you when dealing with
modems (version 3).
SYNOPSIS
baud=CallModemDP(net,number,buffer)
a0 a1 a2
ULONG CallModemDP(APTR, STRPTR, APTR);
baud=CallModemDT(net,number,buffer)
a0 a1 a2
ULONG CallModemDT(APTR, STRPTR, APTR);
FUNCTION
These functions will do the whole procedure for you to dial up a number,
check the result and return the connect rate. If successful CONNECT the
functions return the baudrate. If NULL is returned you should check your
buffer. It will contain what the modem returned such as "NO CARRIER",
"NO ANSWER", "BUSY", "NO DIALTONE", "ERROR", VOICE", "DELAYED" etc.
"CONNECT ..." is the only valid return string for these functions to make
them return true. The baudrate is extracted from the connect string.
Internally they use the ParseConnect() to get the baud rate, but they
copy the string first since ParseConnect() makes the buffer invalid.
Your buffer is due to the internal copy valid after this call and you can
use the ParseConnect() on it if you need to.
If you want to use touch tone dial you can use CallModemDT(). If you of
some reason need pulse dial, call the CallModemDP(). The functions are
compatible and you should let the user of your program deside which one
to use. CallModemDT() is the most common function to call.
The functions has 30 second timeout limit. If no answer to the dialup is
received within 30 seconds or something locks up, the functions will
return with error.
Currently there is no way to terminate a dialup in progress from the
library. You can however call the HangupModem() anytime to break the dial
or to hangup a connection.
INPUTS
net - ptr. to a valid net structure
number - null terminated string that contains the number to dial,
f.ex. "12345678"[0]
buffer - ptr. to a buffer to contain the result. Must be minimum 16
bytes.
RESULTS
baud - the baudrate at connect or NULL if any error. Check your buffer if
NULL is returned.
NOTES
EXAMPLE
move.l Net(pc),a0
lea number(pc),a1
lea buffer(pc),a2
Call CallModemDT
move.l d0,Baud
beq .error
[...]
number dc.b "12345678",0
Buffer dcb.b 16,0
BUGS
You should have a possibility to terminate a dialup in progress before
the phone in the other end picks up the line. You can with having a
subtask sending a HangupModem(), but this isn't reliable timewise.
SEE ALSO
HangupModem(), ParseConnect()
dignet.library/ConvertModemString dignet.library/ConvertModemString
NAME
ConvertModemString -- convert a standard modem string to binary/ascii
(version 3)
SYNOPSIS
newstring=ConvertModemString(string)
a0
STRPTR ConvertModemString(STRPTR);
FUNCTION
This function converts strings used for modem such as "ATZ\r" to its
binary meaning. "ATZ\r" would become "ATZ"(13) in this example.
The function uses the same string buffer as you gave because a convertion
will always make the string shorter than the original string. It also
nullterminates the new string. If you allocated the string you should use
the original length to deallocate the new string.
Currently this function only supports these C-style string commands:
\b - backspace
\e - escape
\f - form feed
\n - linefeed
\r - carriage return
\t - tabulator
The string you provide can contain binary codes as well. It only converts
"\*"-sequences and stops only when it finds a null byte.
INPUTS
string - ptr. to a string you want to send the modem
RESULTS
newstring - ptr. to the converted string (same address as the string you
provided with the function). NOTE: If string is unchanged you
should check the string ptr. you gave or the string content.
It will exit if a0=null
NOTES
EXAMPLE
NewString=ConvertModemString("ATZ\r")
NewString <- ATZ(13)(0)
BUGS
SEE ALSO
InitModem()
dignet.library/FlushNet dignet.library/FlushNet
NAME
FlushNet -- Flushes the net buffers. Useful with AbortNet() (version 3)
SYNOPSIS
error=FlushNet(net)
a0
ULONG FlushNet(APTR);
FUNCTION
This function flushes the IO buffers used by a net. It's useful after you
AbortNet() a net to clean up garbage retuned on the port buffers. From
version 3 the function als have a safty routine after a flush. It reads
the net for garabge and put it to a nil function of the library. That
should guarantee pretty much that when this function returns the buffer
is empty.
INPUTS
net - ptr. to a valid net structure
RESULTS
error - NULL if ok, io_error otherwise
NOTES
EXAMPLE
BUGS
SEE ALSO
AbortNet()
dignet.library/FreeNet dignet.library/FreeNet
NAME
FreeNet -- Frees and cleanup the structure allocated with AllocNet()
SYNOPSIS
error=FreeNet(net)
a0
LONG FreeNet(APTR);
FUNCTION
This function will free the structure allocated with AllocNet(). It will
also flush, abort, wait and close the device and then free memory
allocated with AllocNet().
From version 2.1 this function now returns an error code. Null if ok, -1
(DNETERROR_WRONGNET) if you tried to free a net structure that had wrong
pointer. The error result is for debug purposes. You use it optionally,
but you should test it before a public release.
If you get this error you gave it the wrong net structure pointer or the
net was already freed once.
This feature is a bi-effect of the resource capabillity of the library
implemented in version 2.1.
INPUTS
net - ptr. to a valid net structure
RESULT
error - null if ok, dneterror_wrongnet if wrong net structure was tried
to get freed.
EXAMPLE
error=FreeNet(net)
NOTES
From version 2.1 this function returns an error code.
BUGS
SEE ALSO
AllocNet()
dignet.library/GetBaudrate dignet.library/GetBaudrate
NAME
GetBaudrate -- Returns the current initialized baudrate (version 3)
SYNOPSIS
baudrate=GetBaudrate(net)
a0
ULONG GetBaudrate(APTR);
FUNCTION
This function returns the currently used baudrate from the device. This
is not neccesarly the same baud speed as the modem connect with. However
the baud speed should be as high as possible.
INPUTS
net - ptr. to a valid net structure
RESULTS
baudrate - usigned long integer with the device baud rate or NULL if
error
NOTES
It does not reflect the connect speed if you use the net with a modem.
See the ParseConnect() to obtain connect speed.
EXAMPLE
BUGS
SEE ALSO
SetBaud(), SetDefault()
dignet.library/GetCurrentDevice dignet.library/GetCurrentDevice
NAME
GetCurrentDevice -- returns a pointer to device name currently used.
(version 3)
SYNOPSIS
devicename=GetCurrentDevice(net)
a0
STRPTR GetCurrentDevice(APTR);
FUNCTION
This function will return a pointer to the name of the device currently
used by the net. You should NOT change the content of the string. You are
allowed to copy the string to your own buffer.
The name is correct as long as the net is valid and the above rule is
followed.
INPUTS
net - ptr. to a valid net structure
RESULTS
devicename - ptr. to a nullterminated string containing the device name
of the device currently beeing used. NULL if error.
NOTES
EXAMPLE
BUGS
SEE ALSO
GetCurrentUnit()
dignet.library/GetCurrentUnit dignet.library/GetCurrentUnit
NAME
GetCurrentUnit -- Returns unit number of device used (version 3)
SYNOPSIS
unit=GetCurrentUnit(net)
a0
UWORD GetCurrentUnit(APTR);
FUNCTION
This function returns the unit number of the device currently beeing used
by the net structure. The number is always correct if the net is valid.
INPUTS
net - ptr. to a valid net structure
RESULTS
unit - unit number or -1 if error
NOTES
EXAMPLE
BUGS
SEE ALSO
GetCurrentDevice()
dignet.library/GetIOmsg dignet.library/GetIOmsg
NAME
GetIOmsg -- Returns a pointer to the IO msg used (version 3)
SYNOPSIS
iomsg=GetIOmsg(net)
a0
struct iomsg * GetIOmsg(APTR);
FUNCTION
This function returns a pointer to a IOMSG structure used by the device.
Useful if user want to use the device in a more advanced way.
INPUTS
net - ptr. to a valid net structure
RESULTS
iomsg - ptr. to a iomsg structure or NULL if error
NOTES
EXAMPLE
BUGS
SEE ALSO
GetNetport()
dignet.library/GetModemStatus dignet.library/GetModemStatus
NAME
GetModemStatus -- Returns a bool of the assumed modem state (version 3)
SYNOPSIS
status=GetModemStatus(net)
a0
BOOL GetModemStatus(APTR);
FUNCTION
This function returns a bool of what it thinks the current modem state
is. If false the modem is assumed offline, if true the modem is assumed
to be online. The reason why it has to assume the status if because after
a successful modem dial the user can turn off the modem and on again. The
net structure doesn't know about this.
INPUTS
net - ptr. to a valid net structure
RESULTS
status - BOOL, true if modem is assumed online, false if assumed offline
You will get FALSE if error.
NOTES
The function only assumes the status, it doesn't know for sure.
EXAMPLE
BUGS
Should find a way to check the real status. Some active line or
something. If some of you know, please report to kenny@bgnett.no
SEE ALSO
CallModem(), HangupModem()
dignet.library/GetNetport dignet.library/GetNetport
NAME
GetNetport -- Returns the pointer to the msg port used for net (ver 2)
SYNOPSIS
port=GetNetport(net)
a0
struct MP* GetNetport(APTR);
FUNCTION
This function return a pointer to the public message port used by this
library. You are free to name it. You can with this function use this
more advanced uses such as collecting port signals and Wait() them.
No need to use this function if you don't require advanced uses.
INPUTS
net - ptr. to a valid net structure
RESULTS
port - ptr. to a message port (public). NULL if error.
NOTES
After a FreeNet() call the port is invalid!
EXAMPLE
BUGS
SEE ALSO
GetIOmsg()
dignet.library/HangupModem dignet.library/HangupModem
NAME
HangupModem -- send break and hangup command to modem (version 3)
SYNOPSIS
error=HangupModem(net)
a0
ULONG HangupModem(APTR);
FUNCTION
This function send the a break and hangup command to the modem. The
string it sends is "\w\w+++\w\w\w\wATH\r". This is a standard way to
hangup the modem when online. If you need to hangup the modem otherwise
you should use the WriteNet() function to write your string to the modem
that hang it up. The function will use 3.5 seconds on the hangup.
It also sends the ATH command twice.
You could take a FlushNet() after a HangupModem() call.
INPUTS
net - ptr. to a valid net structure
RESULTS
error - NULL if OK when sending, io_error otherwise
NOTES
Sending a break and hangup command to the modem does NOT guarantee the
modem to hang up. You should check the lights on your modem if it really
hung up.
EXAMPLE
BUGS
SEE ALSO
WriteNet()
dignet.library/InitIOEXT dignet.library/InitIOEXT
NAME
InitIOEXT -- Init the IOEXT structure of a device (serial/duart etc.)
SYNOPSIS
error=InitIOEXT(net,newIOEXT,size)
a0 a1 d0
ULONG InitIOEXT(APTR, APTR *, ULONG);
FUNCTION
This function will init the IOEXT and call the device function
SetParameters. Only use this with devices that are compatible with the
serial device (for example duart.device).
Always use the ReadIOEXT() first to copy current settings of the device
to your buffer. This way you only have to change some fields. If not you
will have to setup the whole IOEXT struture.
INPUTS
net - ptr. to a valid net structure
newIOEXT - ptr. to new settings (IOEXTSER structure)
size - number of bytes to copy
RESULTS
error - reflects the io_error field. Null if ok.
NOTES
For C users: Use struct IOEXTSER *, but you need to add $30 to the
structure's beginning since this function copy only the IOEXTSER part!
Currently max number of chars to read should be 80 bytes.
EXAMPLE
BUGS
Should perhaps used the whole IO stucture to make it more simpler for C
users.
SEE ALSO
ReadIOEXT(), devices/serial.i|h, dignet/dignet.i|h
dignet.library/InitModem dignet.library/InitModem
NAME
InitModem -- Inits a modem with a standard initstring (version 3)
SYNOPSIS
error=InitModem(net,initstring,buffer)
a0 a1 a2
ULONG InitModem(APTR,STRPTR,APTR);
FUNCTION
The function converts the string and sends it to the net where it expect
a modem to be. If no modem found it return with either timeout error or
error code from the io_error field.
A string could be: "ATZ\r"[0] and the function converts this to:
ATZ(13) [13=Carriage Return/CR]
Currently this function only supports these C-style string commands:
\b - backspace
\e - escape
\f - form feed
\n - linefeed
\r - carriage return
\t - tabulator
Other commands will be ignored.
The function copies the io_actual error code to result and the string the
modem replies with to the buffer you provided so you can check or print
the result (eg. OK or ERROR). Note that the buffer must be atleast 16
bytes long.
If user provides a init string which dumps much data, this function will
crop that stream to 16 bytes so it'll fit into the buffer. With correct
use of the init string the modem should return 3 bytes OK(13).
INPUTS
net - ptr. to a valid net structure
initstring - ptr. to a nullterminated init string (required from 3.03).
buffer - ptr. to result buffer (if modem return OK/ERROR). Minimum 16
bytes long.
RESULTS
error - NULL if ok, DNETERROR_TIMEOUT if timeout (maybe no modem),
or io_error in all other cases. You should check the buffer
in any case.
NOTES
From 3.03 you MUST supply an Initstring in A1 !
The buffer you provide MUST be a minimum of 16 bytes long.
This routine gives the modem 3 seconds to reply. It returns immediatly if
it receives a reply from the modem.
EXAMPLE
To check the buffer if it is empty or not you could do (from assembler):
lea Buffer,a0
tst.b (a0)
beq .empty
BUGS
The function wount accept a NULL pointer in A1 (initstring). I beats us
since whatever we do the library doesn't handle it. Maybe an assembler
error ?!
SEE ALSO
CallModem(), ConvertModemString()
dignet.library/ObtainNet dignet.library/ObtainNet
NAME
ObtainNet -- to share a net from another task (version 3)
SYNOPSIS
net=ObtainNet(taskname)
a0
APTR ObtainNet(STRPTR);
FUNCTION
This function will try to find a net allocated by taskname. If success
this function will return with a pointer to the netstructure.
NOTE: It's never safe to use the net structure since you don't know if
the net owner task frees it. You should have very special reasons to use
this function, probably debug reasons or sub tasks that want to use the
net. If so control the freeing with flags or similar.
There will maybe be locking functions in future.
INPUTS
taskname - ptr. to a taskname
RESULTS
net - net structure if success or NULL
NOTES
Use this for special reasons only!
EXAMPLE
BUGS
SEE ALSO
AllocNet()
dignet.library/ParseConnect dignet.library/ParseConnect
NAME
ParseConnect -- Converts a connect string to baudrate (version 3)
SYNOPSIS
baudrate=ParseConnect(buffer)
a0
ULONG ParseConnect(APTR);
FUNCTION
This function will try to convert a CONNECT string returned by
CallModem() in buffer. It then returns the integer value of the connect
speed (real speed).
If buffer contains error messages or is empty this function will return
NULL. The buffer is considered invalid after you have used this function
on it!
INPUTS
buffer - ptr. to the buffer CallModem() returned its connect string.
RESULTS
baudrate - unsigned long integer containing baudrate or NULL if invalid
buffer
NOTES
The buffer is considered invalid after you have used this function on it!
EXAMPLE
BUGS
SEE ALSO
CallModemDT(), CallModemDP()
dignet.library/QueryNet dignet.library/QueryNet
NAME
QueryNet -- Query the device and return number of chars that are
available for read.
SYNOPSIS
chars=QueryNet(net)
a0
ULONG QueryNet(APTR);
FUNCTION
Use this function before you ReadNet() the device. This function will
return number of bytes that are available to read. You can parse the
result directly to ReadNet(). If zero bytes the ReadNet() will abort and
return immediatly.
INPUTS
net - ptr. to a valid net structure
RESULTS
chars - number of chars available to read
NOTES
EXAMPLE
BUGS
SEE ALSO
ReadNet()
dignet.library/ReadIOEXT dignet.library/ReadIOEXT
NAME
ReadIOEXT -- Copies current settings in IOEXT to a buffer
SYNOPSIS
ReadIOEXT(net,buffer,size)
a0 a1 d0
void ReadIOEXT(APTR,APTR,ULONG);
FUNCTION
This function will copy current setting of the IOEXT structure used to
for example to set baud rate in the serial device. The device has to be
compatible with the serial device to read successfully. The reason for
this is that it reads from an offset that is valid for the serial.device.
If another device has its IOEXT structure at same offset this function
and the InitIOEXT() function can be used. Remember to set number of
bytes to copy.
INPUTS
net - ptr. to a valid net structure
buffer - ptr. to a buffer to copy to
size - number of bytes to copy
NOTES
Currently max number of chars to read should be 80 bytes.
DO NOT use devices that are not compatible with the serial.device or
the IOEXTSER structure!
EXAMPLE
BUGS
SEE ALSO
InitIOEXT(), devices/serial.i|h, dignet/dignet.i|h
dignet.library/ReadNet dignet.library/ReadNet
NAME
ReadNet -- reads x bytes from the device
SYNOPSIS
error=ReadNet(net,buffer,size)
a0 a1 d0
ULONG ReadNet(APTR,APTR,ULONG);
FUNCTION
This function will read from the device. You should first call a query
function to check the number of bytes waiting and then read those into
your buffer. If zero bytes this function will abort immediatly so it is
safe to call it. If you ask for more bytes than are available this
function will wait until the amount can be read from the port. Use
AbortNet() to cancel the wait or use Timeout() to give some time to get
some bytes on the port before a ReadNet() is called. This function reads
byte-by-byte to not miss any chars from the buffer.
INPUTS
net - ptr. to a valid net structure
buffer - ptr. to a buffer
size - number of bytes to read
RESULTS
error - null if ok, else it reflects the io_error field
NOTES
EXAMPLE
error=ReadNet(net,buffer,queryresult|timeoutresult)
BUGS
SEE ALSO
WriteNet(), QueryNet(), AbortNet(), Timeout()
dignet.library/ReadString dignet.library/ReadString
NAME
ReadString -- read a null terminated string from net (version 2)
SYNOPSIS
error=ReadString(net,buffer,max)
a0 a1 d0
ULONG ReadString(APTR,APTR,ULONG);
FUNCTION
This function will read a string until it reaches a null termination byte
or buffer overflows. Useful with the function WriteString() which sends a
null terminated string to the net.
CHANGES: if this function returns -1 (from version 2.1) it means buffer
overflow. You should act on that and continue to read after you have
cleaned up. Other non-null returns are errors returned from io_error
field. Consult the serial.device documentation to get the definitions on
those.
INPUTS
net - ptr. to a valid net structure
buffer - ptr. to buffer to keep the string
max - max length of string
RESULTS
error - NULL if OK. -1 if buffer overflow, otherwise io_error.
NOTES
NOTE WELL: This function returns -1 from version 2.1. It returned 1 in
earlier version, but that could conflict with the dev_busy error (1).
Please update your programs. Sorry for the inconvinient.
EXAMPLE
BUGS
See notes!
SEE ALSO
WriteString(), QueryNet(), Timeout(), AbortNet()
dignet.library/RTAbort dignet.library/RTAbort
NAME
RTAbort -- Tries to abort an allocated net (version 3)
SYNOPSIS
RTAbort(ID)
d0
void RTAbort(ULONG);
FUNCTION
This function will try to abort a net. If the net isn't in use the
function will return immediatly. There is no saftcheck on the pointers.
INPUTS
ID - ID of a net
NOTES
EXAMPLE
BUGS
SEE ALSO
RTNetInfo
dignet.library/RTCheck dignet.library/RTCheck
NAME
RTCheck -- Checks the count list for mismatch (version 3)
SYNOPSIS
status=RTCheck()
BOOL RTCheck(void);
FUNCTION
This function check the resource tracklist and the opennet counter for
any mismatch. If this function return FALSE there is a mismatch in the
count lists. That could mean some net isn't properly killed (invalid
pointer was given to RTKillNet() or something like that). If there is a
mismatch you have to cleanup manually by finding the net that should be
killed and then FreeNet() it. You do so at your own risk!
RESULTS
status - TRUE if ok, otherwise FALSE and system is in risk.
NOTES
EXAMPLE
BUGS
SEE ALSO
RTNumberofNets()
dignet.library/RTFlush dignet.library/RTFlush
NAME
RTFlush -- Tries to flush an allocated net (version 3)
SYNOPSIS
RTFlush(ID)
d0
void RTFlush(ULONG);
FUNCTION
This function will try to flush an allocated net. You should check for
the existance of the net by using the RTNetInfo() function first.
INPUTS
ID - ID of a net
NOTES
EXAMPLE
BUGS
SEE ALSO
RTNetInfo()
dignet.library/RTHighestID dignet.library/RTHighestID
NAME
RTHighestID -- Return the highest ID number (version 3)
SYNOPSIS
HighestID=RTHighestID()
ULONG RTHighestID(void);
FUNCTION
This function will return the highest ID number available. If there are
no nets if will return NULL. This function is useful when you will parse
a list.
RESULTS
HighestID - highest ID number or NULL if no nets are allocated
NOTES
EXAMPLE
BUGS
SEE ALSO
RTNetInfo()
dignet.library/RTKillNet dignet.library/RTKillNet
NAME
RTKillNet -- Tryes to kill an allocated net (version 3)
SYNOPSIS
RTKillNet(ID)
d0
void RTKillNet(ULONG);
FUNCTION
This function will try to kill an allocated net. You should however use
the function RTNetInfo() first to check if the netowener task is in
tasklist or not. You shouldn't kill a net that is owned by a healthy
task.
If the net ID isn't valid the function will return immediatly.
INPUTS
ID - Net ID.
NOTES
DO NOT use this function on a healthy task!
EXAMPLE
BUGS
SEE ALSO
RTNetInfo(), RTAbort(), RTFlush()
dignet.library/RTNetInfo dignet.library/RTNetInfo
NAME
RTNetInfo -- Returns vital information about a net ID (version 3)
SYNOPSIS
success=RTNetInfo(buffer,ID)
a0 d0
BOOL RTNetInfo(APTR,ULONG);
FUNCTION
This function will copy vital information from the private RT structure
in the library to a public structure (see dignet/dignet.i|h). If the net
ID isn't valid (eg. isn't used) the function will return immediatly with
FALSE in bool.
INPUTS
buffer - ptr. to a buffer that contains the structure (DNRT_SIZEOF)
ID - net ID to get info about
RESULTS
success - TRUE (-1) if success, otherwise FALSE
NOTES
EXAMPLE
BUGS
SEE ALSO
RTHighestID(), RTNumberofNets(), dignet/dignet.i|h
dignet.library/RTNumberofNets dignet.library/RTNumberofNets
NAME
RTNumberofNets -- Returns number of open nets (version 3)
SYNOPSIS
number=RTNumberofNets()
ULONG RTNumberofNets(void);
FUNCTION
This function will return number of open nets in the system. You should
use the RTCheck to find out any mismatch in the net count and resource
trackers counter.
RESULTS
number - number of nets open
NOTES
This function doesn't return the highest available number of nets. Use
the function RTHighestID() to find that out.
EXAMPLE
BUGS
SEE ALSO
RTCheck(), RTHighestID()
dignet.library/SetBaud dignet.library/SetBaud
NAME
SetBaud -- updeates the device with a new baudrate (version 3).
SYNOPSIS
error=SetBaud(net,baud)
a0 d0
ULONG SetBaud(APTR,ULONG);
FUNCTION
Use this function to update just the baud rate. The baudrate should be an
integer value, for example: baud=38400.
INPUTS
net - ptr. to a valid net structure
baud - integer value describing the baud rate.
RESULTS
error - NULL if OK, otherwise io_error or -1 if a0 or d0 is null.
NOTES
Most devices communciating with the serial port do not support baud rates
in a linear way. Read the documentation about which baud rates the device
supports.
EXAMPLE
BUGS
SEE ALSO
ReadIOExt(), InitIOExt()
dignet.library/SetDefault dignet.library/SetDefault
NAME
SetDefault -- Set default parameters to a "safe" setup (version 3)
SYNOPSIS
error=SetDefault(net)
a0
ULONG SetDefault(APTR);
FUNCTION
This function will initialize the modem with considered "safe" settings.
the following parameters are set:
Buffer size: 8194
Flags: 7WIRE + BOGGIE + XDISABLED + NOPARITY.
BAUD: 38400 (this is not the connect baud)
8 bits per char
1 stopbit
This setup should work for any Amiga. If you have a slow Amiga (68000 or
68010) you should use the SetBaud() function and set baud to 19200. If
you have a faster Amiga than 68030/25 Mhz you can set use the SetBaud()
function to set 57000 or better. The BOGGIE and 7WIRE make sure that you
can accept highspeed transfers. Without those you may get garbage. You
can use the ReadIOEXT() and InitIOEXT() to change flags and more.
INPUTS
net - ptr. to a valid net structure
RESULTS
error - NULL if ok, otherwise io_error
NOTES
EXAMPLE
BUGS
SEE ALSO
SetBaud(), ReadIOEXT(), InitIOEXT()
dignet.library/StopWaiting dignet.library/StopWaiting
NAME
StopWaiting -- Terminates a WaitModem() call (version 3)
SYNOPSIS
StopWaiting(net)
a0
void StopWaiting(APTR);
FUNCTION
This function sends a termiate message to the WaitModem() function. The
WaitModem() will otherwise never return if it not receive a RING string
first. It may take some seconds before the function returns after the
terminate message is sent. The buffer should contain "TERMINATED" if this
was the reason.
INPUTS
net - ptr. to a valid net structure
NOTES
Calling it with no WaitModem() waiting has no effect and is safe.
EXAMPLE
BUGS
SEE ALSO
WaitModem()
dignet.library/Timeout dignet.library/Timeout
NAME
Timeout -- waits x seconds to receive char(s) on the device for reading
SYNOPSIS
chars=Timeout(net,seconds)
a0 d0
ULONG Timeout(APTR,UWORD);
FUNCTION
You can use this function to give a device a certain amont of time to get
a char or more on the port for reading. You set seconds to wait. If a
char or more is received the function will return with the current amount
of chars in buffer. If timeout occure it will return with NULL.
Null seconds is valid, however it will just call the QueryNet() function
instead and return immediatly.
If you lock up waiting for chars with ReadNet() or ReadString() use the
AbortNet() function.
INPUTS
net - ptr. to a valid net structure
seconds - number of seconds to wait for timeout
RESULTS
chars - number of chars received before timeout or NULL if none
NOTES
The seconds are divided in smaller parts so the function don't have to
wait a whole second to return if there are chars on the buffer.
EXAMPLE
BUGS
It should use WaitPort() instead of Delay() + Query. Will maybe be fixed
in future.
SEE ALSO
QueryNet(), AbortNet()
dignet.library/WriteNet dignet.library/WriteNet
NAME
WriteNet -- Writes x bytes to the device
SYNOPSIS
error=WriteNet(net,buffer,size)
a0 a1 d0
ULONG WriteNet(APTR,APTR,ULONG);
FUNCTION
This function write a number of bytes (really a copy) from a buffer of
size x. The function returns immediatly.
INPUTS
net - ptr. to a valid net structure
buffer - ptr. to a buffer taht contains bytes to write
size - number of bytes to write
RESULTS
error - reflects the io_error field. Null if ok.
NOTES
EXAMPLE
error=WriteNet(net,buffer,3351)
BUGS
In earlier versions there had to be implemented a delay of 20/50 of a
second to get all chars read from the io buffer. This is fixed for
the version 2 release. The library now read and writes byte-by-byte to
not loose any chars.
SEE ALSO
ReadNet()
dignet.library/WriteString dignet.library/WriteString
NAME
WriteString -- Writes a nullterminated string to net (v.2)
SYNOPSIS
error=WriteString(net,string)
a0 a1
ULONG WriteString(APTR,STRPTR);
FUNCTION
This function is pretty similar to WriteNet(). In fact this function
is just a pre-function to WriteNet(). It counts the number of chars in
the string until zero is found and the calls the WriteNet() function with
length as parameter. Read about WriteNet() for more info.
The result code is actually returned be WriteNet() and reflects the
io_error field. Null if ok.
INPUTS
net - ptr. to a valid net structure
string - ptr. to a null-terminated string
RESULTS
error - reflects the io_error field. Null if ok.
NOTES
EXAMPLE
BUGS
SEE ALSO
ReadString()